
package visualcbir.command;
import java.util.*;


public class CmdMacro
{
    int cont=-1;
    public CmdMacro(){}
    public Vector<ICommand> commands = new Vector<ICommand>();
    public void add(ICommand c) 
    {   
        commands.add(c); 
    }
    public void undoCommand() 
    {      
        commands.lastElement().undo();                 
        commands.remove(commands.lastElement());        
    }
    public void redoCommand() 
    {   commands.elementAt(cont).execute();         
    }
    //public void redo() { commands.add(); }
    public void run() 
    {
        Iterator it = commands.iterator();
        while(it.hasNext())
          ((ICommand)it.next()).execute();
    }
}
